home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Games Special 4 / THE BEST OF SELECT Games Special 4 (Select CD-ROM)(1996).iso / dosgames / abuse / lisp / people.lsp < prev    next >
Lisp/Scheme  |  1995-09-13  |  23KB  |  881 lines

  1. ;; Copyright 1995 Crack dot Com,  All Rights reserved
  2. ;; See licensing information for more details on usage rights
  3.  
  4. (setq bright_tint (def_tint "art/tints/cop/bright.spe"))  ;; used when the player fires a weapon
  5. (setq player_tints (make-array 6 :initial-contents (list 
  6.                             (def_tint "art/tints/cop/blue.spe")
  7.                             (def_tint "art/tints/cop/africa.spe")
  8.                             (def_tint "art/tints/cop/fire.spe")
  9.  
  10.                             (def_tint "art/tints/cop/olive.spe")
  11.                             (def_tint "art/tints/cop/land.spe")
  12.                             (def_tint "art/tints/cop/gold.spe")
  13.  
  14. )))
  15.  
  16.  
  17.  
  18. (setq cop_dead_parts (make-array (* 4 3) :initial-contents 
  19.                    ;       head           arm            leg
  20.                  '((CP_1  "4dha") (CP_2  "4daa") (CP_3  "4dba")     ; disapear
  21.                    (CP_4  "4dhf") (CP_5  "4daf") (CP_6  "4dbf")     ; flaming
  22.                    (CP_7  "4dae") (CP_8  "4dle") (CP_9  "4dbe")     ; electrical
  23.                    (CP_10 "4dhn") (CP_11 "4dan") (CP_12 "4dbn"))))  ; normal
  24.  
  25.  
  26. (do ((i 0 (setq i (+ i 1))))
  27.        ((>= i 12) nil)
  28.        (setq (aref cop_dead_parts i) 
  29.          (make_dead_part (car (aref cop_dead_parts i))          
  30.                  (car (cdr (aref cop_dead_parts i))) 4 "art/cop.spe" 'dead_cop_part_draw)))
  31.  
  32.  
  33.  
  34.  
  35.  
  36. (setf fast_image (def_image "art/misc.spe" "fast_image"))
  37. (setf fly_image (def_image "art/misc.spe" "fly_image"))
  38. (setf sneaky_image (def_image "art/misc.spe" "sneaky_image"))
  39. (setf health_image (def_image "art/misc.spe" "b_check_image"))
  40.  
  41.  
  42. (defun give_player_health (amount)
  43.   (let ((h_amount  (select difficulty
  44.                ('easy    amount)
  45.                ('medium  (/ (* amount 3) 4))
  46.                ('hard    (/ amount 2))
  47.                ('extreme (/ amount 4))))
  48.     (h_max (if (eq special_power HEALTH_POWER)
  49.            200
  50.          100)))
  51.     (if (eq (hp) h_max)
  52.     nil
  53.       (progn
  54.     (if (<= (+ (hp) h_amount) h_max)
  55.         (add_hp h_amount)
  56.       (add_hp (- h_max (hp))))
  57.     (setq b_ramp (+ b_ramp (* h_amount 2)))
  58.  
  59.     T)))
  60. )
  61.     
  62.  
  63.  
  64. (defun pressing_action_key ()
  65.   (> (player_y_suggest) 0))
  66.  
  67.  
  68. ; signals for user function
  69. (enum 'SET_SNEAKY_TIME
  70.       'SET_VISOR_TIME
  71.       'SET_FAST_TIME
  72.       'SET_FADE_COUNT
  73. )
  74.  
  75.  
  76. ; states for cop
  77. (enum 'JUST_START
  78.       'NORMAL_PLAY)
  79.  
  80.  
  81. (enum 'NO_POWER
  82.       'FAST_POWER
  83.       'FLY_POWER
  84.       'SNEAKY_POWER
  85.       'HEALTH_POWER)
  86.  
  87.  
  88. (defun cop_ufun (signal value)
  89.   (if (< (total_objects) 1)    ; make sure upper body is there
  90.       nil
  91.     (select signal
  92.         (SET_SNEAKY_TIME 
  93.          (progn 
  94.            (set_sneaky_time value)
  95.            (with_obj0 (set_sneaky_time value))))
  96.         (SET_VISOR_TIME (set_visor_time value))
  97.         (SET_FAST_TIME 
  98.          (progn 
  99.            (set_fast_time value)
  100.            (with_obj0 (set_fast_time value))))
  101.         (SET_FADE_COUNT (set_fade_count value) 
  102.                 (with_obj0 (set_fade_count value)))
  103.          
  104.         )))
  105.             
  106.  
  107. (defun cop_adjust_top (return)
  108.   (if (< (total_objects) 1)        ;; should be here
  109.       (let ((me (me)))
  110.     (link_object (add_object_after MGUN_TOP (x) (y)))
  111.     (with_obj0 (link_object me))
  112.     ))
  113.   return
  114. )
  115.  
  116. (defun climb_off_handler ()
  117.   (if (next_picture)
  118.       (progn
  119.     (view_push_down 4)
  120.     0)
  121.     (progn
  122.       (set_y (- (y) 28))
  123.       (set_state stopped)
  124.       0)))
  125.  
  126. (defun climb_handler (xm ym but)
  127.   (let ((yd in_climbing_area))
  128.     (setq in_climbing_area 0)
  129.     (if (eq (state) climb_off)
  130.     (climb_off_handler)
  131.       (if (eq (state) climbing)
  132.       (progn
  133.         (if (> ym 0)
  134.         (progn
  135.           (if (eq (current_frame) 0) (set_current_frame 9) 
  136.             (set_current_frame (- (current_frame) 1)))
  137.           (set_y (+ (y) 3)))
  138.           (if (< ym 0)
  139.           (progn
  140.             (if (< yd 32)
  141.             (set_state climb_off)
  142.               (progn
  143.             (if (not (next_picture)) (set_state climbing))
  144.             (set_y (- (y) 3)))))))
  145.         (if (not (eq xm 0))
  146.         (if (can_see (x) (- (y) 20) (x) (y) nil)
  147.             (if (eq ym 0)
  148.             (progn
  149.               (set_state run_jump_fall)
  150.               (set_gravity 1))
  151.               (progn
  152.             (set_state run_jump)
  153.             (set_yvel (get_ability jump_yvel))
  154.             (set_gravity 1)
  155.             ))))
  156.  
  157.         0)
  158.     (if (and (>= (yvel) 0) (or (> ym 0) 
  159.                    (and (< ym 0) (> yd 8))))
  160.         (progn
  161.           (set_state climbing)
  162.           (set_gravity 0)
  163.           (set_xvel 0)
  164.           (set_yvel 0)
  165.           (set_xacel 0)
  166.           (set_yacel 0)
  167.           0)
  168.       (progn
  169.         (next_picture)
  170.         (cop_adjust_top (mover xm ym but))))
  171.     ))))
  172.       
  173.       
  174. (defun undo_special_power (xm ym but)
  175.   (select special_power
  176.       (FAST_POWER   (setq used_special_power 0))
  177.       (SNEAKY_POWER (if (> used_special_power 0)
  178.                 (setq used_special_power (- used_special_power 1))))))
  179.  
  180. (defun do_special_power (xm ym but)
  181.   (select special_power
  182.       (FLY_POWER
  183.        (add_object CLOUD (+ (+ (x) (* (direction) -10)) (random 5)) (+ (y) (random 5)))
  184.        (set_state run_jump)
  185.        (set_gravity 1)
  186.        (set_yacel 0)
  187.        (if (> (yvel) 0) (set_yvel (/ (yvel) 2)))
  188.        (set_yvel (- (yvel) 2))
  189.        (if (< ym 0)
  190.            (set_yvel (- (yvel) 1)))
  191.        )
  192.       
  193.  
  194.       (FAST_POWER 
  195.        (setq used_special_power 1)
  196.        (setq last1_x (x))
  197.        (setq last1_y (y))
  198.        (if (> (total_objects) 0)
  199.            (with_obj0
  200.                 (if (> fire_delay1 0) 
  201.                 (setq fire_delay1 (- fire_delay1 1)))))
  202.  
  203.        
  204.        (let ((in_area in_climbing_area)
  205.          (old_yvel (yvel)))
  206.          (player_move xm ym but)
  207.          (setq in_climbing_area in_area)
  208.          (if (and (< ym 0) (eq old_yvel 0) (< (yvel) 0))
  209.          (set_yvel (+ (yvel) (/ (yvel) 3))))
  210.          
  211.          )
  212.  
  213.        (setq last2_x (x))
  214.        (setq last2_y (y)))
  215.  
  216.       (SNEAKY_POWER (if (<= used_special_power 15)               
  217.                 (setq used_special_power (+ used_special_power 1))))
  218.       ))
  219.  
  220. (defun player_move (xm ym but)
  221.   (if (eq in_climbing_area 0)
  222.       (progn
  223.     (if (eq (state) climbing)
  224.         (progn
  225.           (set_gravity 1)
  226.           (set_state run_jump_fall)))
  227.     (next_picture)
  228.     (cop_adjust_top (mover xm ym but)))
  229.     (climb_handler xm ym but)))
  230.  
  231. /*(defun cop_mover (xm ym but) 
  232.   (if (> (yvel) 10) 
  233.       (progn 
  234.     (set_yacel 0)
  235.     (set_yvel (- (yvel) 1))))  ;; terminal velocity
  236.   (select (aistate)
  237.       (JUST_START 
  238.        (if (eq but 0)              ; wait till user lets go of button before moving           
  239.            (progn
  240.          (set_aistate NORMAL_PLAY)
  241.          (mover xm ym but))
  242.          (cop_adjust_top (tick))))
  243.       (NORMAL_PLAY
  244.        (if (or (<= (hp) 0) (eq (state) dieing) (eq (state) dead))    ; are we dead?
  245.            (progn
  246.          (if (not (eq (state) dead))
  247.              (if (not (eq (state) dieing))
  248.              (progn
  249.                (set_state dieing)
  250.                (set_xvel 0)
  251.                (set_yvel 0)
  252.                (set_xacel 0)
  253.                (set_yacel 0))
  254.                (if (not (next_picture))
  255.                (set_state dead) nil))
  256.            (if (not (eq but 0)) ; wait till dead and pressing but, then reset
  257.                (progn
  258.              (restart_player)
  259.              (set_aistate JUST_START))
  260.              (cop_adjust_top (tick))))
  261.          0)
  262.  
  263.          ; normal play code
  264.          (progn
  265.            ; check to see if player is firing
  266.            (if (equal (bit-and but 1) 1)
  267.            (do_special_power xm ym but)
  268.          (undo_special_power xm ym but))
  269.            
  270.            (let ((ret (player_move xm ym but))
  271.              (other (me)))
  272.          (with_obj0 
  273.                   (progn
  274.                 (set_x (with_object other (x)))
  275.                 (set_y (- (- (with_object other (y)) -29) 
  276.                       (with_object other (picture_height))))
  277.                 ))
  278.          (if (and (equal (bit-and but 2) 2)
  279.               (not (eq (state) dead)) (not (eq (state) dieing)))
  280.              (let ((ammo (ammo_total (current_weapon_type))))
  281.                (add_ammo (current_weapon_type) (with_obj0 
  282.                                     (user_fun 'FIRE ammo)))
  283.                nil))
  284.          ret)
  285.            )))))
  286.  
  287. )*/
  288.  
  289. ;;(defun normal_bottom_mover ()  ;; just runs around
  290.  
  291. (defun dead_cop_part_draw ()
  292.   (if (eq (aitype) 0)
  293.       (draw)
  294.     (draw_tint (aref player_tints (aitype)))))
  295.  
  296. (defun bottom_damage (amount from hitx hity push_xvel push_yvel)  ; transfer damage to lower half
  297.   (if (eq is_teleporting 1)
  298.       nil
  299.     (let ((amount (select difficulty;; reduce damage according to difficulty
  300.               ('easy   (/ amount 2))
  301.               ('medium (/ (* amount 3) 4))
  302.               ('hard    amount)
  303.               ('extreme (* amount 2))
  304.               )))
  305.  
  306.  
  307.       (select (aistate)
  308.           (NORMAL_PLAY (if (and (not (eq (state) dieing)) (not (eq (state) dead)))
  309.                    (progn
  310.                  (if (eq (random 2) 0)
  311.                      (set_state flinch_up)
  312.                    (set_state flinch_down))                   
  313.                  (setq r_ramp (+ r_ramp (* amount 7)))
  314.                  (setq g_ramp (- g_ramp (* amount 14)))
  315.                  (setq b_ramp (- b_ramp (* amount 14)))
  316.                  (if (> r_ramp 120) (setq r_ramp 120))
  317.                  (if (< g_ramp 0) (setq g_ramp 0))
  318.                  (if (< b_ramp 0) (setq b_ramp 0))
  319.                  (damage_